import App from "../App";

const home = (r) =>
  require.ensure([], () => r(require("../page/home")), "home");
const reset = (r) =>
  require.ensure([], () => r(require("../page/reset")), "other");
const info = (r) => require.ensure([], () => r(require("../page/info")), "zp");

//member
const editInfo = (r) =>
  require.ensure([], () => r(require("../page/member/editInfo")), "member");
//mine
const moneyBack = (r) =>
  require.ensure([], () => r(require("../page/mine/moneyBack")), "mine");
const score = (r) =>
  require.ensure([], () => r(require("../page/mine/score")), "mine");
const setting = (r) =>
  require.ensure([], () => r(require("../page/mine/setting")), "mine");
const personalCenter = (r) =>
  require.ensure([], () => r(require("../page/mine/personalCenter")), "mine");

// //order
const orderPre = (r) =>
  require.ensure([], () => r(require("../page/order/orderPre")), "order");
const orderPreTest = (r) =>
  require.ensure([], () => r(require("../page/order/orderPreTest")), "order");
const orderPreTest2 = (r) =>
  require.ensure([], () => r(require("../page/order/orderPreTest2")), "order");
const orderList = (r) =>
  require.ensure([], () => r(require("../page/order/orderList")), "order");
const orderConfirm = (r) =>
  require.ensure([], () => r(require("../page/order/orderConfirm")), "order");
const orderErr = (r) =>
  require.ensure([], () => r(require("../page/order/orderErr")), "order");
const orderSucc = (r) =>
  require.ensure([], () => r(require("../page/order/orderSucc")), "order");

//aboutMe
const activity = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/activity")), "aboutMe");
const activity_detail = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/detail")), "aboutMe");
const history = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/history")), "aboutMe");
const memberCent = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/memberCent")), "aboutMe");
const prodCent = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/prodCent")), "aboutMe");
const sales = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/sales")), "aboutMe");
const convention = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/convention")), "aboutMe");

const link1 = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/link1")), "aboutMe");
const link2 = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/link2")), "aboutMe");
const link3 = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/link3")), "aboutMe");
const link4 = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/link4")), "aboutMe");
const link5 = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/link5")), "aboutMe");

const report = (r) =>
  require.ensure([], () => r(require("../page/aboutMe/report")), "aboutMe");

//err
const Err404 = (r) =>
  require.ensure([], () => r(require("../page/error/Err404")), "other");

//address
const newAddress = (r) =>
  require.ensure([], () => r(require("../page/address/newAddress")), "address");

//activity 活动页
const watchVideo = (r) =>
  require.ensure(
    [],
    () => r(require("../page/activity/watchVideo")),
    "activity"
  );
const watchVideo2 = (r) =>
  require.ensure(
    [],
    () => r(require("../page/activity/watchVideo2")),
    "activity"
  );
const confirmVideo = (r) =>
  require.ensure(
    [],
    () => r(require("../page/activity/confirmVideo")),
    "activity"
  );
const envoll = (r) =>
  require.ensure([], () => r(require("../page/activity/envoll")), "activity");
const envollSucc = (r) =>
  require.ensure(
    [],
    () => r(require("../page/activity/envollSucc")),
    "activity"
  );
const envollErr = (r) =>
  require.ensure(
    [],
    () => r(require("../page/activity/envollErr")),
    "activity"
  );
const ethics = (r) =>
  require.ensure([], () => r(require("../page/activity/ethics")), "activity");
const v0329 = (r) =>
  require.ensure([], () => r(require("../page/activity/v0329")), "activity");
const v0330 = (r) =>
  require.ensure([], () => r(require("../page/activity/v0330")), "activity");

const Qa = (r) =>
  require.ensure([], () => r(require("../page/activity/qa")), "activity");
const QaS = (r) =>
  require.ensure(
    [],
    () => r(require("../page/activity/qasuccess")),
    "activity"
  );

import article from "./article";
import doctor from "./doctor";
import channel from "./channel";

export default [
  {
    path: "/",
    component: App, //顶层路由，对应index.html
    children: [
      //二级路由。对应App.vue
      //地址为空时跳转home页面
      {
        path: "",
        component: home,
        meta: { title: "脂谱身心健康" },
      },
      {
        path: "/",
        component: home,
        meta: { title: "脂谱身心健康" },
      },
      {
        path: "/reset",
        component: reset,
        meta: { title: "清除缓存" },
      },
      {
        path: "/info",
        component: info,
        meta: { title: "个人中心" },
      },
      {
        path: "/editInfo",
        component: editInfo,
        meta: { title: "会员注册" },
      },
      {
        path: "/score",
        component: score,
        meta: { title: "我的特权" },
      },
      {
        path: "/moneyBack",
        component: moneyBack,
        meta: { title: "返现" },
      },
      {
        path: "/setting",
        component: setting,
        meta: { title: "编辑资料" },
      },
      {
        path: "/orderPre",
        component: orderPre,
        meta: { title: "订单预览" },
      },
      {
        path: "/order/orderList",
        component: orderList,
        meta: { title: "我的订单" },
      },
      {
        path: "/order/orderConfirm",
        component: orderConfirm,
        meta: { title: "订单详情" },
      },
      {
        path: "/orderSucc",
        component: orderSucc,
        meta: { title: "支付成功" },
      },
      {
        path: "/orderErr",
        component: orderErr,
        meta: { title: "支付失败" },
      },
      {
        path: "/personalCenter",
        component: personalCenter,
        meta: { title: "个人中心" },
      },
      {
        path: "/orderPreTest",
        component: orderPreTest,
        meta: { title: "脂肪谱检测" },
      },
      {
        path: "/orderPreTest2",
        component: orderPreTest2,
        meta: { title: "脂肪谱检测" },
      },
      {
        path: "/detail/:id",
        component: activity_detail,
        meta: {
          title(to) {
            return to.query.title || "推广中心-详细";
          },
        },
      },
      {
        path: "/history",
        component: history,
        meta: { title: "展望历史" },
      },
      {
        path: "/link1",
        component: link1,
        meta: { title: "展望生命(欧米伽3脂肪酸)胶囊" },
      },
      {
        path: "/link2",
        component: link2,
        meta: { title: "活动介绍" },
      },
      {
        path: "/link3",
        component: link3,
        meta: { title: "科普：欧米伽3的健康科学知识" },
      },
      {
        path: "/link4",
        component: link4,
        meta: { title: "《健康中国.一带一路.双百工程》介绍" },
      },
      {
        path: "/link5",
        component: link5,
        meta: { title: "中国健康促进与教育协会”【2016】29号（文件）" },
      },
      {
        path: "/report",
        component: report,
        meta: { title: "检测报告" },
      },
      {
        path: "/memberCent",
        component: memberCent,
        meta: { title: "会员中心" },
      },
      {
        path: "/prodCent",
        component: prodCent,
        meta: { title: "产品中心" },
      },
      // {
      //   path: '/sales',
      //   component: sales,
      //   meta: { title: "过新年，我的健康我来团" }
      // },
      {
        path: "/convention",
        component: convention,
        meta: { title: "展望生命-重庆之旅" },
      },
      {
        path: "/newAddress",
        component: newAddress,
        meta: { title: "地址管理" },
      },
      {
        path: "/ipad",
        component: watchVideo2,
        meta: { title: "领赠品" },
      },
      {
        path: "/confirmVideo/:type",
        component: confirmVideo,
        meta: { title: "领赠品" },
      },
      {
        path: "/envoll",
        component: envoll,
        meta: { title: "2018秋冬营报名" },
      },
      {
        path: "/envollSucc",
        component: envollSucc,
        meta: { title: "报名成功" },
      },
      {
        path: "/envollErr",
        component: envollErr,
        meta: { title: "报名成功" },
      },
      {
        path: "/ethics",
        component: ethics,
        meta: { title: "伦理批件" },
      },
      {
        path: "/qa/:type",
        component: Qa,
        meta: { title: "知识竞答" },
      },
      {
        path: "qasuccess",
        component: QaS,
        meta: { title: "恭喜您！您已完成知识竞答！" },
      },
      {
        path: "/v0329",
        component: v0329,
        meta: { title: "恭喜您！您已成功预约！" },
      },
      {
        path: "/v0330",
        component: v0330,
        meta: { title: "恭喜您！您已成功预约！" },
      },
      article,
      doctor,
      channel,
      {
        path: "/404",
        component: home,
      },
      { path: "*", redirect: "/404" },
    ],
  },
];
